package de.bazinga.rotw.base.attacker;

import com.captiveimagination.jgn.message.Message;
import com.captiveimagination.jgn.message.type.CertifiedMessage;
import com.captiveimagination.jgn.message.type.PlayerMessage;
import com.captiveimagination.jgn.message.type.TimestampedMessage;

import de.bazinga.rotw.game.RotwGameState;
import de.bazinga.rotw.network.message.GameMessage;

public class AttackerDiedMessage extends Message implements CertifiedMessage, PlayerMessage, TimestampedMessage, GameMessage {
	private int attackerId = 0;
	
	public void handleMessage(RotwGameState game, Message msg, boolean server) {
		if(!(msg instanceof AttackerDiedMessage)) return ;
		
		if(server) {
			
		}else{
			if(AttackerList.getAttackers() != null) {
				for(BaseAttacker att:AttackerList.getAttackers()) {
					if(att.getAttackerId() == attackerId) {
						att.died(false);
						return ;
					}
				}
			}
		}
	}

	public void setAttackerId(int attackerId) {
		this.attackerId = attackerId;
	}

	public int getAttackerId() {
		return attackerId;
	}
}